<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  pageEncoding="ISO-8859-1"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="conversation.css" rel="STYLESHEET" type="text/css">
<title>Annotate Message</title>
</head>
<body>
<!--        Header         -->
<jsp:include page="scripts/headerAnnotate.jsp">
<jsp:param name="title" value="Annotate Message" />
</jsp:include>
<jsp:include page="scripts/toggleLayer.js" />
<!--       Navigation        -->
<jsp:include page="scripts/mnavigation.jsp" />
<!--        Metadata         -->
<div class="meta">
<form method="post">
<table>
  <tr>
    <th width="125">Data Set ID:</th>
    <td><c:out value="${message.conversation.dataset.datasetId}" /></td>
    <th>Conversation ID:</th>
    <td><c:out value="${message.conversation.conversationId}" /></td>
    <th>Message ID:</th>
    <td><c:out value="${message.messageId}" /></td>
  </tr>
  <tr>
    <th>Sequence:</th>
    <td><c:out value="${message.sequence}" /></td>
    <th>Speaker:</th>
    <td><c:out value="${message.speaker}" /></td>
    <th>Type:</th>
    <td><c:out value="${message.type}" /></td>
  </tr>
  <tr>
    <th>Date Time:</th>
    <td colspan="5"><c:out value="${message.dateTime}" /></td>
  </tr>
  <tr>
    <th>Content:</th>
    <td colspan="5"><c:out escapeXml="false" value="${message.contentString}" /></td>
  </tr>
  <tr>
    <th>Note:</th>
    <td colspan="5" align="center"><spring:bind path="message.note">
      <textarea cols="60" rows="3"
        name='<c:out value="${status.expression}"/>'><c:out
        value="${status.value}" /></textarea>
    </spring:bind></td>
  </tr>
  <tr>
    <th>Annotation:</th>
    <td colspan="5">
      <div class="annotate"> <table border="0">
      <!-- For each annotation scheme  -->
      <c:forEach items="${daschemes}" var="dascheme">
        <tr><td valign="top"><a href="javascript:toggleLayer('<c:out value="${dascheme}"/>')"><b><c:out value="${dascheme}" />:</b></a></td></tr>
        <tr><td valign="top">
          <div class="annoPanel" id="<c:out value='${dascheme}'/>">
          <spring:bind path="message.dialogueActLabels">
            <select size="30" name="<c:out value='${status.expression}'/>" multiple="multiple">
            <c:forEach items="${dalabels}" var="dalabel">
              <c:if
                test="${dalabel.dialogueActDimension.dialogueActScheme.dialogueActSchemeId == dascheme.dialogueActSchemeId}">
                <c:forEach items="${status.value}" var="currentDalabel">
                  <c:if
                    test="${dalabel.dialogueActLabelId == currentDalabel.dialogueActLabelId}">
                    <c:set var="selected" value="true" />
                  </c:if>
                </c:forEach>
                <option value="<c:out value='${dalabel.dialogueActLabelId}'/>"
                  <c:if test="${selected}">selected="selected"</c:if>>
                    <c:out value="${dalabel.dialogueActDimension.dimension}" />
                    : <c:out value="${dalabel.label}" />
                </option>
                <c:remove var="selected" />
              </c:if>
            </c:forEach>
            </select>                                     
        </spring:bind>
        </div>
        </td></tr>
      </c:forEach>
    </table>
    </div></td>
  </tr>
  <tr>
    <td colspan="7"><input type="submit" value="Save" /> <input
      type="button" value="Cancel"
      onClick="javascript:window.location='annotatemessage.jsp'" /></td>
  </tr>
</table>
</form>
<jsp:include page="scripts/footer.jsp" />
</body>
</html>
